package org.sabayframework.channel.impl;

import org.sabayframework.channel.Lock;

public abstract class ReadOnlyChannel<T> extends AbstractChannel<T> {

	public static void raiseReadOnlyException(){
		throw new IllegalStateException("Read-only channel");
	}
	@Override
	public final Lock<T> getWriteLock(int size) {
		raiseReadOnlyException();
		return null;
	}

	@Override
	public final void add(T elem) throws IllegalStateException {
		raiseReadOnlyException();
	}
	
	@Override
	public int freeSize() {
		return 0;
	}
	
	@Override
	public int capacity() {
		return 0;
	}
	
	@Override
	public boolean isFull() {
		return true;
	}

}
